﻿using System;
using System.Collections.ObjectModel;
using System.Text;
using System.Security;
using System.Security.Cryptography;
using MUD.Lib.Utils;
using MUD.Lib.Objects.Users;
using MUD.Lib.Objects.Domains;
using System.Reflection;

namespace MUD.Lib.Daemons
{
    internal class DomainController
    {
        public Collection<Domain> Domains = new Collection<Domain>();

        public DomainController() { }

        public void Initialize()
        {
            Assembly thisAssembly = Assembly.GetAssembly(Type.GetType("MUD.Lib.Master"));
            Type[] types = thisAssembly.GetTypes();
            // HACK: OMFG THIS HURTS! There has to be a better way to dynamically load domains.
            Domain testDomain = new Domain();
            foreach (Type type in types)
            {
                if (type.IsSubclassOf(testDomain.GetType()))
                {
                    Domain temp = (Domain)Activator.CreateInstance(type);
                    temp.Initialize();
                    Domains.Add(temp);
                }
            }
        }
    }
}
